<template>
    <div class="company-user">
        <index-breadcrumb :breadcrumb-list="breadcrumbList"></index-breadcrumb>
        <projectFile :operation-list="operationList" :is-show="showStatus">
        </projectFile>
    </div>
</template>

<script>
import projectFile from "@/views/projectFile/includes/ProjectFile";

export default {
    name: "ProjectFile",
    components: {
        projectFile,
    },
    data() {
        return {
            operationList: [],
            breadcrumbList: [
                {
                    title: "项目管理"
                },
                {
                    title: "文件管理"
                },
            ],
            showStatus: true,
        };
    },
    activated() {
        this.getOperationList();
        let item = JSON.parse(localStorage.getItem("viewProject"))
        this.breadcrumbList = [
            {
                title: "项目管理"
            },
            {
                title: item.projectName
            },
            {
                title: "文件管理"
            },
        ]
    },
    methods: {
        backShow() {
            this.showStatus = true
        },
        getOperationList() {
            this.$store.state.permissionList.forEach(item => {
                const [itemName] = item.permission.split(":");
                if (itemName === "project") {
                    item.list.map(listItem => {
                        const [subItemName] = listItem.permission.split(":");
                        if (subItemName === "projectFile") {
                            var permission = listItem.permission.split(":")[1]
                            if (!this.operationList.includes(permission)) {
                                this.operationList.push(permission)
                            }
                        }
                    });
                }
            });
        }
    },
};
</script>

<style lang="sass" scoped>

</style>
